-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support of asg and alb. #11
Initial support of asg and alb. #11
Conversation
d768497
to
e3a12ab
Compare
cumulus/steps/dev_tools/pipeline.py
Outdated
generic_pipeline = codepipeline.Pipeline( | ||
"Pipeline", | ||
# Name=chain_context.instance_name, | ||
Name=chain_context.instance_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this is being added back in ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflict error, will fix.
cumulus/steps/ec2/alb.py
Outdated
alb_sg = ALB_SG_NAME % self.name | ||
|
||
# TODO: this SG shouldn't be required.. test. | ||
template.add_resource(ec2.SecurityGroup( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably get to that eventually in the infra blueprint that this came from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're not using the one where it came from anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this one, and I don't see any ramifications in the net result, so I will leave it out.
cumulus/steps/ec2/alb.py
Outdated
|
||
def create_default_target_group(self, template): | ||
template.add_resource(alb.TargetGroup( | ||
TARGET_GROUP_DEFAULT % self.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we run two instances of this, ie a bswift and a sauter instance separately, this looks like we'll get name collisions. Prefix support in cumulus is probably a bigger discussion.
cumulus/steps/ec2/dns.py
Outdated
EvaluateTargetHealth=False, | ||
), | ||
Name=Join("", [ | ||
Ref("stackname"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this was brought over from the builder project but we have a concept of self.name, chain_context.instance_name, and now Ref("stackname").
Can we streamline these ? Is stackname really required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not required, can use the other options if they are providing a stackname.
cumulus/steps/ec2/ingress_rule.py
Outdated
FromPort=self.port_to_open, | ||
ToPort=self.port_to_open, | ||
CidrIp=self.cidr, | ||
GroupId=Ref(chain_context.metadata[META_SECURITY_GROUP_NAME]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a slight departure from a convention the pipeline introduced.. it's not a big deal but might be good to streamline as much as possible.
Instead of popping the name on the metadata, pipeline put the Ref object on it. Which makes the most sense? Should the pipeline change or should this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found putting it on the metadata was pretty intuitive!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so did I. The question was should we put a string or a ref. If we stick with the precedence in master we'd put a Ref object on the metadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either works. I don't see either case being more or less easy to work with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make this one use a ref on the metadata.
cumulus/steps/ec2/launch_config.py
Outdated
self.meta_data = meta_data | ||
self.instance_profile_name = instance_profile_name | ||
self.vpc_id = vpc_id | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the following could be derived, and at least made optional here, to simplify the consumer requirements.
- asg_name
- launch_config_name
- instance_profile_name
cumulus/steps/ec2/launch_config.py
Outdated
asg_sg_list = [self._get_launch_configuration_security_groups(chain_context.metadata[META_SECURITY_GROUP_NAME])] | ||
|
||
parameters = { | ||
'ImageId': FindInMap('AmiMap', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugh, so like stacker and parameters, stacker has an opinion on mappings.
These mappings are required to exist in stacker.yaml, for the sample code here. This poses another problem if cumulus is going to be non-stacker specific..
I think the best way to do this would be to supply a way to generate mappings in the way cumulus wants. Something for a separate story/feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue #14 created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this PR we should probably just document an example mapping section in the class docs of the class.
cumulus/steps/ec2/listener_rule.py
Outdated
Values=[ | ||
Ref("stackname"), | ||
"-", | ||
Ref("namespace"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
namespace, and stackname again. Are these bleeding in from stacker? Namespace is a stacker concept.. although the code that this was brought in from.. (the builder) didn't have a working host_pattern. So maybe this could be tackled separately.. as I'm guessing this isn't tested in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A fix / documents here are still pending.
cumulus/steps/ec2/port.py
Outdated
from cumulus.chain import step | ||
|
||
|
||
class Port(step.Step): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name here is too generic. This is specifically a class for ASG--> ALB traffic.
I think it's ok to nuke this class and have this done directly where the target group is added. Likely in the consumer code there are ports being passed into a few places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix
cumulus/steps/ec2/role.py
Outdated
from cumulus.util.tropo import TemplateQuery | ||
|
||
|
||
class Role(step.Step): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This role is specific to an instance profile, so we might want to name it specifically that.
There will be many other things that want to call themselves "Role_xxx".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix
cumulus/steps/ec2/target_group.py
Outdated
|
||
# todo: why is this not allowing a reference? | ||
|
||
name = 'CumulusTargetGroup' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause collisions on multiple instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix
cumulus/steps/ec2/scaling_group.py
Outdated
from cumulus.steps.ec2 import META_SECURITY_GROUP_NAME, META_TARGET_GROUP_NAME | ||
|
||
|
||
class LaunchType: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplication, also exists in cumulus/types.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove one of them
the_chain.add(ingress_rule.IngressRule( | ||
name="SgCidrAccess", | ||
port_to_open="22", | ||
asg_sg_name="sg1" + self.name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above, this is the client code that gets really confusing, having to pass around asg_sg_name in a bunch of places. When it gets derived and pulled into one of the steps we won't have to worry about it here.
I think the user needs to know too much about steps and sequencing
217ab94
to
46186d0
Compare
46186d0
to
03b9a82
Compare
Add flake8 to the ci build
Fix flake8 errors from PR #11
Initial implementation of the alb and asg steps.
This pull request contains steps that will facilitate the deployment of an alb and asg. There are some assumptions around scaling groups and the creation of an alb at this point.